/*
 * Powered By [pkuWx]
 * Web Site: http://www.wuxi.ss.pku.edu.cn
 * Since 2015 - 2015
 */

package cn.edu.pku.wxlib.book.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import cn.org.rapid_framework.util.DateConvertUtils;

import java.util.*;

import cn.edu.pku.wxlib.book.model.*;
import cn.edu.pku.wxlib.book.service.*;
import cn.edu.pku.wxlib.book.vo.query.*;

import javacommon.base.*;
import javacommon.util.*;
import javacommon.page.Page;

/**
 * @version 1.0
 * @since 1.0
 */


public class Book extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "Book";
	public static final String ALIAS_BOOK_ID = "bookId";
	public static final String ALIAS_BOOK_NUMBER = "图数编号[举个栗子G624.53/200(2009)]";
	public static final String ALIAS_ISBN = "国际标准图书编号";
	public static final String ALIAS_BOOK_NAME = "书名";
	public static final String ALIAS_AUTHOR = "作者";
	public static final String ALIAS_TRANSLATOR = "译者";
	public static final String ALIAS_BRIEF = "简介";
	public static final String ALIAS_PUBLISHER = "出版社";
	public static final String ALIAS_EDITION = "版本";
	public static final String ALIAS_PRINT_NUMBER = "印次";
	public static final String ALIAS_PRICE = "价格";
	public static final String ALIAS_BOOKLANGUAGE = "语言";
	public static final String ALIAS_PUBLISH_TIME = "出版时间";
	public static final String ALIAS_CATEGORY_ID = "图书类型ID";
	public static final String ALIAS_NOTE = "备注";
	public static final String ALIAS_STORAGE_TOTAL_NUMBER = "入库数量";
	public static final String ALIAS_LEND_TOTAL_NUMBER = "可外借数量";
	public static final String ALIAS_BOOKUSAGE = "用途[1工具书/2教科书/3其它]";
	public static final String ALIAS_SOURCE = "来源";
	
	//date formats
	public static final String FORMAT_PUBLISH_TIME = DATE_FORMAT;
	
	//columns START
    /** bookId       db_column: bookId */	
	
	private java.lang.Integer bookId;
    /** 图数编号[举个栗子G624.53/200(2009)]       db_column: bookNumber */	
	@Length(max=17)
	private java.lang.String bookNumber;
    /** 国际标准图书编号       db_column: ISBN */	
	@NotBlank @Length(max=13)
	private java.lang.String isbn;
    /** 书名       db_column: bookName */	
	@NotBlank @Length(max=128)
	private java.lang.String bookName;
    /** 作者       db_column: author */	
	@Length(max=128)
	private java.lang.String author;
    /** 译者       db_column: translator */	
	@Length(max=32)
	private java.lang.String translator;
    /** 简介       db_column: brief */	
	@Length(max=1024)
	private java.lang.String brief;
    /** 出版社       db_column: publisher */	
	@Length(max=64)
	private java.lang.String publisher;
    /** 版本       db_column: edition */	
	@Length(max=16)
	private java.lang.String edition;
    /** 印次       db_column: printNumber */	
	@Length(max=32)
	private java.lang.String printNumber;
    /** 价格       db_column: price */	
	
	private java.lang.Double price;
    /** 语言       db_column: booklanguage */	
	@Length(max=32)
	private java.lang.String booklanguage;
    /** 出版时间       db_column: publishTime */	
	
	private java.util.Date publishTime;
    /** 图书类型ID       db_column: categoryId */	
	
	private java.lang.Integer categoryId;
    /** 备注       db_column: note */	
	@Length(max=256)
	private java.lang.String note;
    /** 入库数量       db_column: storageTotalNumber */	
	
	private java.lang.Integer storageTotalNumber;
    /** 可外借数量       db_column: lendTotalNumber */	
	
	private java.lang.Integer lendTotalNumber;
    /** 用途[1工具书/2教科书/3其它]       db_column: bookusage */	
	
	private java.lang.Integer bookusage;
    /** 来源       db_column: source 来源（1，购买；2，捐赠）*/	
	private java.lang.Integer source;
	@Length(max=128)
	private java.lang.String imageUrl;
	//columns END

	public Book(){
	}

	public Book(
		java.lang.Integer bookId
	){
		this.bookId = bookId;
	}

	public void setBookId(java.lang.Integer value) {
		this.bookId = value;
	}
	
	public java.lang.Integer getBookId() {
		return this.bookId;
	}
	public void setBookNumber(java.lang.String value) {
		this.bookNumber = value;
	}
	
	public java.lang.String getBookNumber() {
		return this.bookNumber;
	}
	public void setIsbn(java.lang.String value) {
		this.isbn = value;
	}
	
	public java.lang.String getIsbn() {
		return this.isbn;
	}
	public void setBookName(java.lang.String value) {
		this.bookName = value;
	}
	
	public java.lang.String getBookName() {
		return this.bookName;
	}
	public void setAuthor(java.lang.String value) {
		this.author = value;
	}
	
	public java.lang.String getAuthor() {
		return this.author;
	}
	public void setTranslator(java.lang.String value) {
		this.translator = value;
	}
	
	public java.lang.String getTranslator() {
		return this.translator;
	}
	public void setBrief(java.lang.String value) {
		this.brief = value;
	}
	
	public java.lang.String getBrief() {
		return this.brief;
	}
	public void setPublisher(java.lang.String value) {
		this.publisher = value;
	}
	
	public java.lang.String getPublisher() {
		return this.publisher;
	}
	public void setEdition(java.lang.String value) {
		this.edition = value;
	}
	
	public java.lang.String getEdition() {
		return this.edition;
	}
	public void setPrintNumber(java.lang.String value) {
		this.printNumber = value;
	}
	
	public java.lang.String getPrintNumber() {
		return this.printNumber;
	}
	public void setPrice(java.lang.Double value) {
		this.price = value;
	}
	
	public java.lang.Double getPrice() {
		return this.price;
	}
	public void setBooklanguage(java.lang.String value) {
		this.booklanguage = value;
	}
	
	public java.lang.String getBooklanguage() {
		return this.booklanguage;
	}
	public String getPublishTimeString() {
		return DateConvertUtils.format(getPublishTime(), FORMAT_PUBLISH_TIME);
	}
	public void setPublishTimeString(String value) {
		setPublishTime(DateConvertUtils.parse(value, FORMAT_PUBLISH_TIME,java.util.Date.class));
	}
	
	public void setPublishTime(java.util.Date value) {
		this.publishTime = value;
	}
	
	public java.util.Date getPublishTime() {
		return this.publishTime;
	}
	public void setCategoryId(java.lang.Integer value) {
		this.categoryId = value;
	}
	
	public java.lang.Integer getCategoryId() {
		return this.categoryId;
	}
	public void setNote(java.lang.String value) {
		this.note = value;
	}
	
	public java.lang.String getNote() {
		return this.note;
	}
	public void setStorageTotalNumber(java.lang.Integer value) {
		this.storageTotalNumber = value;
	}
	
	public java.lang.Integer getStorageTotalNumber() {
		return this.storageTotalNumber;
	}
	public void setLendTotalNumber(java.lang.Integer value) {
		this.lendTotalNumber = value;
	}
	
	public java.lang.Integer getLendTotalNumber() {
		return this.lendTotalNumber;
	}
	public void setBookusage(java.lang.Integer value) {
		this.bookusage = value;
	}
	
	public java.lang.Integer getBookusage() {
		return this.bookusage;
	}
	public void setSource(java.lang.Integer value) {
		this.source = value;
	}
	
	public java.lang.Integer getSource() {
		return this.source;
	}

	public java.lang.String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(java.lang.String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("BookId",getBookId())
			.append("BookNumber",getBookNumber())
			.append("Isbn",getIsbn())
			.append("BookName",getBookName())
			.append("Author",getAuthor())
			.append("Translator",getTranslator())
			.append("Brief",getBrief())
			.append("Publisher",getPublisher())
			.append("Edition",getEdition())
			.append("PrintNumber",getPrintNumber())
			.append("Price",getPrice())
			.append("Booklanguage",getBooklanguage())
			.append("PublishTime",getPublishTime())
			.append("CategoryId",getCategoryId())
			.append("Note",getNote())
			.append("StorageTotalNumber",getStorageTotalNumber())
			.append("LendTotalNumber",getLendTotalNumber())
			.append("Bookusage",getBookusage())
			.append("Source",getSource())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getBookId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof Book == false) return false;
		if(this == obj) return true;
		Book other = (Book)obj;
		return new EqualsBuilder()
			.append(getBookId(),other.getBookId())
			.isEquals();
	}
}

